﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dmp_ui_demo
{
    /// <summary>
    /// 文章实体
    /// </summary>
    [Serializable]
    public class Article : ICloneable
    {
        private string title;
        private ParagraphList paragraphs;
        private Paragraph root;
        internal Dictionary<object, Paragraph> allParagraph = new Dictionary<object, Paragraph>();
        public string Title
        {
            set
            {
                title = value;
            }
            get
            {
                return title ?? string.Empty;
            }
        }
        public string Edittime { get; set; }
        public string Updatetime { get; set; }

        public ParagraphList Paragraphs
        {
            get
            {
                if (this.paragraphs == null)
                {
                    this.paragraphs = new ParagraphList(this.root);
                }
                return this.paragraphs;
            }
        }

        public Article()
        {
            this.root = new Paragraph(this);
        }

        public object Clone()
        {
            return this.MemberwiseClone();
        }
    }
}
